/* eslint-disable quotes */
import request from '@/utils/request'

// 分页查询客户信息
export function getData(data) {
  return request({
    url: '/system/customer/page_query_list',
    method: 'post',
    data,
  })
}
// 根据id查询单个客户信息
export function getCustomList(id) {
  return request({
    url: `/system/customer/selectCustById/${ id }`,
    method: 'get',
  })
}
export function clientMangerList(params) {
  return request({
    url: 'system/clientManger/info/list',
    params,
  })
}
// 删除客户信息
export function delData(data) {
  return request({
    // eslint-disable-next-line prefer-template
    url: "/system/customer/delete",
    method: 'delete',
    data,
  })
}
// 修改客户特殊产品
export function editData(ids) {
  return request({
    url: '/system/customer/weighing/edit',
    method: 'put',
    data: { ids },
  })
}
// 客户账期修改
export function editModel(data) {
  return request({
    url: 'system/clientManger/info/editModel',
    method: 'put',
    data,
  })
}

// 客户临时账期修改
export function activitiEditModel({ data, ...other }) {
  return request({
    url: '/activiti/actDemands/revocationProcess',
    method: 'post',
    data,
    ...other,
  })
}
// 添加客户特殊产品
export function addData(data) {
  return request({
    url: '/system/customer/weighing/add',
    method: 'post',
    data,
  })
}

export function delImg(data) {
  return request({
    url: `system/clientManger/info/deleteContract/${ data.id }/${ data.state }`,
    method: 'post',
    data: { fileName: data.fileName },
  })
}
// 通过id获取客户特殊产品
export function getCus(data) {
  return request({
    url: '/system/customer/weighing/query_list',
    method: 'post',
    data,
  })
}

export function updCus(data) {
  return request({
    url: 'system/custWeighing',
    method: 'put',
    data,
  })
}

export function addCus(data) {
  return request({
    url: 'system/custWeighing',
    method: 'post',
    data,
  })
}

export function delCus(ids) {
  return request({
    url: `system/custWeighing/${ ids }`,
    method: 'delete',
  })
}

export function getCusById(id) {
  return request({
    url: `system/custWeighing/${ id }`,
  })
}

// 获取运输类型列表

export function getQueryModel(params) {
  return request({
    url: 'system/clientManger/info/queryModel',
    params,
  })
}
// 获取临时账期列表
export function paymentList(params) {
  return request({
    url: 'system/interim/payment/list',
    params,
  })
}

// 新增运输类型 费用

export function saveMode(data) {
  return request({
    url: '/system/clientManger/info/saveModel',
    method: 'post',
    data,
  })
}

// 删除 运输类型费用

export function deleteModel(data) {
  return request({
    url: '/system/clientManger/info/deleteModel',
    method: 'post',
    data,
  })
}

// 客户接口
export function clientListByCode(params) {
  return request({
    url: '/system/clientManger/info/listByCode',
    params,
  })
}

// hy- 最新用户接口 2021/9/13
export const listByCode = () => request({
  url: '/system/clientManger/info/custlist',
})

// 批量修改客户等级
export function updataGrade(data) {
  return request({
    url: '/system/customer/batch_grade',
    method: 'put',
    data,
  })
}

// 启用禁用接口
export function PutEnableQuotaEdit(data) {
  return request({
    url: 'system/clientManger/info/enableQuotaEdit',
    method: 'put',
    data,
  })
}
// 密码解密
export function passwordDecryption(username) {
  return request({
    url: `system/user/passwordDecryption/${ username }`,
  })
}
// 客户状态修改
export function editCustStatus(data) {
  return request({
    url: '/system/clientManger/info/editCustStatus',
    method: 'put',
    data,
  })
}
// 客户临时账期修改
export const interimPayment = data => request({
  url: '/system/interim/payment',
  method: 'put',
  data,
})
// 末端额度充值列表
export function getRechargeRecord(customerCode) {
  return request({
    url: '/system/customer/select_record',
    method: 'get',
    params: { customerCode },
  })
}
// 增加额度
export function editRecharge(data) {
  return request({
    url: '/system/customer/recharge_b',
    method: 'post',
    data,
  })
}
// 修改末端额度充值
export function paymentInsert(data) {
  return request({
    url: '/system/interim/payment/insert',
    method: 'post',
    data,
  })
}
// 客户修改可预定方数
export function modifyBooking(data) {
  return request({
    url: '/system/customer/batch_mdifyBooking',
    method: 'put',
    data,
  })
}
// 批量修改业务员
export function editSalemans(data) {
  return request({
    url: '/system/customer/batch_businessManager',
    method: 'put',
    data,
  })
}
// 查询所有销售产品
export function getProductList(data) {
  return request({
    url: '/system/product/selectSysSellingProductsListByPage',
    method: 'post',
    data,
  })
}
